package 动态规划;

/**
 * @ClassName _343整数拆分
 * @Description TODO
 * @Author 昝亚杰
 * @Date 2021/12/31 17:01
 * Version 1.0
 **/
public class _343整数拆分 {
    public static void main(String[] args) {
        int i = integerBreak(5);
    }
    public static int integerBreak(int n) {
        int[]  result = new int[n + 1];
        result[2] = 1;
        for(int i = 3; i < n + 1; i++){
            for(int j = 1; j < i; j++){
                result[i] = Math.max(result[i],Math.max(j*(i- j),j*result[i - j]));
            }
        }
        return result[n];
    }
}
